package com.tyut.musicdreamer.service.search.client;

import com.tyut.musicdreamer.framework.starter.convention.result.Result;
import com.tyut.domain.MusicDocument;
import com.tyut.domain.TagDocument;
import com.tyut.domain.UserDocument;
import com.tyut.domain.dto.SearchRequest;
import com.tyut.domain.vo.SearchResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 搜索服务API接口
 * 提供给其他服务调用的Feign客户端接口
 */
@FeignClient(name = "musicdreamer-service-search", path = "/api/search")
public interface SearchClient {

    /**
     * 综合搜索
     * 
     * @param request 搜索请求
     * @return 搜索结果
     */
    @PostMapping
    Result<?> search(@RequestBody SearchRequest request);

    /**
     * 搜索音乐
     * 
     * @param request 搜索请求
     * @return 搜索结果
     */
    @PostMapping("/music")
    Result<SearchResult<MusicDocument>> searchMusic(@RequestBody SearchRequest request);

    /**
     * 搜索用户
     * 
     * @param request 搜索请求
     * @return 搜索结果
     */
    @PostMapping("/user")
    Result<SearchResult<UserDocument>> searchUser(@RequestBody SearchRequest request);

    /**
     * 搜索标签
     * 
     * @param request 搜索请求
     * @return 搜索结果
     */
    @PostMapping("/tag")
    Result<SearchResult<TagDocument>> searchTag(@RequestBody SearchRequest request);

    /**
     * 简单搜索
     * 
     * @param keyword 关键词
     * @param type 搜索类型（music, user, tag, all）
     * @param pageNum 页码
     * @param pageSize 每页大小
     * @return 搜索结果
     */
    @GetMapping("/simple")
    Result<?> simpleSearch(
            @RequestParam("keyword") String keyword,
            @RequestParam(value = "type", defaultValue = "music") String type,
            @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize);
} 